import Vue from 'vue'; //首先引入vue
import Vuex from 'vuex'; //引入vuex
Vue.use(Vuex);


const  state ={
    armyData: [
        {
            id: "",
            title: "智慧军营",
            uplevelid: "",
            faceimg: null,
            principalid: "",
            isteam: null,
            item: []
        },
    ],
    count:1,
    upImageList:[],
}

const getters ={
    // getters 类似 computed
    // 在这里面写个方法
    getTreeArr(state) {
        return state.armyData
    }
}
const mutations = {
    ADD_TREE_DATA(state, stark) {
        // if (stark) {
        //     state.armyData = stark;
        // }
        state.count++;
        console.log('storezhong数据-----:', state.armyData)
    },

}

const actions = {
    addTreeData(context, actionData) {
        context.commit('ADD_TREE_DATA', '');
        // Vue.set(state.treeArr,stark)
        console.log('数据----dd-:', state.armyData)
        console.log('canshu-dsfdsf----:', actionData)
    },


}
const store = new Vuex.Store({
    state,
    getters,
    mutations,
    actions,
});
export default store;